<html>
<body>
<script>
/**
 * context handler
 */
function contextEvent(info,tab) {
	if(info.menuItemId == drawHeatId) {
		goto({"drawHeatMap": "1"});
		
	} else if(info.menuItemId == hideHeatId) {
		goto({"hideCanvas": "1"});
	}
}

/**
 * send request 
 */
function goto(data) {
	chrome.tabs.getSelected(null, function(tab) {			
		chrome.tabs.sendRequest(tab.id, data,function(response) {				
		});
   });			
}

/**
 * create context menu
 */
var drawHeatId = chrome.contextMenus.create(
  {"title": "draw heatMap",  "contexts":["all"],"onclick": contextEvent});
var hideHeatId = chrome.contextMenus.create(
  {"title": "hide heatMap","contexts":["all"],"onclick": contextEvent});
  
</script>
</body>
</html>